package 文件字符流;

import java.io.FileWriter;
import java.io.IOException;

public class 文件字符写入流 {
    public static void main(String[] args) {
        FileWriter writer = null;
        try {
            writer = new FileWriter("IO流/src/myfile",true);
//            写入char数组
            char[] chars = {'我','是','中','国','人'};
            writer.write(chars);
//            写入字符串
            String s = "哈哈哈啊哈";
            writer.write(s);
            writer.flush();
        } catch (IOException e) {
            e.printStackTrace();
        }finally {
            if (writer != null){
                try {
                    writer.close();
                } catch (IOException e) {
                    e.printStackTrace();
                }
            }
        }

    }
}
